home *** CD-ROM | disk | FTP | other *** search
- // Update Notifier
- // By Todd Long <longfocus@gmail.com>
- // http://www.longfocus.com/firefox/updatenotifier/
-
- function UNItem() {}
- UNItem.prototype = {
- _id: null,
- _type: null,
- _url: null,
- _version: null,
-
- get id() { return this._id; },
- get type() { return this._type; },
- get url() { return this._url; },
- get version() { return this._version; },
-
- set id(aId) { this._id = aId; },
- set type(aType) { this._type = aType; },
- set url(aURL) { this._url = aURL; },
- set version(aVersion) { this._version = aVersion; },
-
- QueryInterface: function(iid)
- {
- if (!iid.equals(Components.interfaces.nsIUNItem) &&
- !iid.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
- return this;
- }
- }
-
- var myModule = {
- firstTime: true,
-
- myCID: Components.ID("{c0e0d3e0-9e6b-11da-a746-0800200c9a66}"),
- myDesc: "Item available for update",
- myProgID: "@longfocus.com/updatenotifier/item;1",
- myFactory: {
- createInstance: function (outer, iid) {
- if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
-
- return (new UNItem()).QueryInterface(iid);
- }
- },
-
- registerSelf: function (compMgr, fileSpec, location, type)
- {
- if (this.firstTime) {
- this.firstTime = false;
- throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
- }
-
- compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
- compMgr.registerFactoryLocation(this.myCID, this.myDesc, this.myProgID, fileSpec, location, type);
- },
-
- getClassObject: function (compMgr, cid, iid)
- {
- if (!cid.equals(this.myCID))
- throw Components.results.NS_ERROR_NO_INTERFACE;
-
- if (!iid.equals(Components.interfaces.nsIFactory))
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
- return this.myFactory;
- },
-
- canUnload: function(compMgr) { return true; }
- };
-
- function NSGetModule(compMgr, fileSpec) { return myModule; }
-